fix: context condensing prompt not saving properly#5634
fix: context condensing prompt not saving properly#5634kevinvandijk merged 4 commits intoKilo-Org:mainfrom
Conversation
Fixes Kilo-Org#5629 - Add local state for condensing prompt to prevent flickering during typing - Initialize local state when switching to CONDENSE tab - Sync with extension state on blur to ensure persistence - Prevent race condition between user input and extension state updates
🦋 Changeset detectedLatest commit: caef0f0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Mirror: fix: context condensing prompt not saving properly (Kilo-Org#5634)
| if (activeSupportOption === "CONDENSE") { | ||
| setLocalCondensingPrompt(customCondensingPrompt) | ||
| } | ||
| }, [activeSupportOption, customCondensingPrompt]) |
There was a problem hiding this comment.
[WARNING]: Including customCondensingPrompt in this dependency array may undermine the anti-flickering protection.
When the user is actively typing, the flow is:
onInput→setLocalCondensingPrompt(value)+updateSupportPrompt(...)→setCustomCondensingPrompt(value)+vscode.postMessage(...)- If the extension processes the message and sends back a different/normalized value (e.g., via
ExtensionStateContext),customCondensingPromptchanges - This
useEffectfires and overwriteslocalCondensingPromptwith the extension's value — exactly the flickering scenario this PR aims to prevent
Consider depending only on activeSupportOption so the local state is initialized only when switching tabs, not overwritten during active editing:
| }, [activeSupportOption, customCondensingPrompt]) | |
| }, [activeSupportOption]) // eslint-disable-line react-hooks/exhaustive-deps |
Alternatively, you could use a ref to track whether the user is actively editing and skip the sync in that case.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Fix these issues in Kilo Cloud Overview
Issue Details (click to expand)WARNING
Other Observations (not in diff)Issues found in unchanged code or cross-cutting concerns that cannot receive inline comments:
Files Reviewed (2 files)
|
Fixes #5629
Problem
Context condensing prompt was clearing out and not saving properly when typing.
Root Cause
The VSCodeTextArea was directly controlled by extension state. Every keystroke triggered a save to extension state → webview re-render → race condition caused text to clear.
Solution
Changes
Testing